package com.modai.springcloud.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ：modai
 * @date ：Created in 2020-12-9 0:16
 * @description：
 */
@Configuration
public class GateWayConfig {
    @Bean
    public RouteLocator customRouter(RouteLocatorBuilder builder){
        RouteLocatorBuilder.Builder routes = builder.routes();
        routes.route("国际",r->r.path("/guoji").uri("https://news.baidu.com/guoji")).build();
        routes.route("游戏",r-> r.path("/game").uri("https://news.baidu.com/game")).build();
        return routes.build();
    }
}
